package com.ysxsoft.wdg.util.sp;

import android.content.Context;

import com.ysxsoft.wdg.MyApplication;


/**
 * sp工具类
 */
public class SharePrefUtils extends SharePrefBase {

    /**
     * sp存放字段的key
     */
    public interface SPKey {
        String USER_ID = "userId";
        String IS_FIRST = "isFirst";
        /**纬度**/
        String LATITUDE = "latitude";
        /**经度**/
        String LONGITUDE = "longitude";
        String ADDRESS = "address";
        String USER_CODE="usercode";
    }

    public static String getUserId() {
        return getString(MyApplication.getContext(), SPKey.USER_ID, "");
    }

    public static void saveUserId(String userId) {
        saveString(MyApplication.getContext(), SPKey.USER_ID, userId);
    }

    /**纬度**/
    public static String getLatitude() {
        return getString(MyApplication.getContext(), SPKey.LATITUDE, "");
    }
    /**纬度**/
    public static void saveLatitude(String latitude) {
        saveString(MyApplication.getContext(), SPKey.LATITUDE, latitude);
    }
    /**经度**/
    public static String getLongitude() {
        return getString(MyApplication.getContext(), SPKey.LONGITUDE, "");
    }
    /**经度**/
    public static void saveLongitude(String longitude) {
        saveString(MyApplication.getContext(), SPKey.LONGITUDE, longitude);
    }
    /**地址**/
    public static String getAddress() {
        return getString(MyApplication.getContext(), SPKey.ADDRESS, "");
    }
    /**地址**/
    public static void saveAddress(String longitude) {
        saveString(MyApplication.getContext(), SPKey.ADDRESS, longitude);
    }

    /**邀请码**/
    public static String getUserCode() {
        return getString(MyApplication.getContext(), SPKey.USER_CODE, "");
    }
    /**邀请码**/
    public static void saveUserCode(String userCode) {
        saveString(MyApplication.getContext(), SPKey.USER_CODE, userCode);
    }

    public static boolean isStartFirst(Context context) {
        return getBoolean(context, SPKey.IS_FIRST, true);
    }

    public static void saveStartStatus(boolean isFirst) {
        saveBoolean(MyApplication.getContext(), SPKey.IS_FIRST, isFirst);
    }


}